/**
 * 
 */
package com.globalresources.business.impl;

import java.util.List;

import com.globalresources.business.inface.IGroupsService;
import com.globalresources.po.Groups;
import com.globalresources.dao.inface.IGroupsDao;

/**
 * @author Administrator
 *
 */
public class GroupsServiceImpl implements IGroupsService {

	private IGroupsDao groupsDao;
	
	/* (non-Javadoc)
	 * @see com.globalresources.business.inface.IGroupsService#deleteGroups(com.globalresources.po.Groups)
	 */
	public boolean deleteGroups(Groups groups) {
		// TODO Auto-generated method stub
		return groupsDao.deleteGroups(groups);
		
	}

	/* (non-Javadoc)
	 * @see com.globalresources.business.inface.IGroupsService#findBySql(java.lang.String)
	 */
	public List<Groups> findBySql(String sql) {
		// TODO Auto-generated method stub		
		return groupsDao.findAll(sql);
	}

	/* (non-Javadoc)
	 * @see com.globalresources.business.inface.IGroupsService#listGroups()
	 */
	public List<Groups> listGroups() {
		// TODO Auto-generated method stub
		return groupsDao.findAll("from Groups groups order by groups.id desc");
	}

	/* (non-Javadoc)
	 * @see com.globalresources.business.inface.IGroupsService#saveGroups(com.globalresources.po.Groups)
	 */
	public boolean saveGroups(Groups groups) {
		// TODO Auto-generated method stub
		return groupsDao.saveGroups(groups);
	}

	/* (non-Javadoc)
	 * @see com.globalresources.business.inface.IGroupsService#saveOrUpdateGroups(com.globalresources.po.Groups)
	 */
	public boolean saveOrUpdateGroups(Groups groups) {
		// TODO Auto-generated method stub
		return groupsDao.saveOrUpdate(groups);
	}

	
	/* (non-Javadoc)
	 * @see com.globalresources.business.inface.IGroupsService#getGroupsById(com.globalresources.po.Groups)
	 */
	public Groups getGroupsById(String id) {
		// TODO Auto-generated method stub
		Groups groups=(Groups)(groupsDao.findAll("from Groups groups where groups.id='"+id+"'").get(0));
		return groups;
	}

	/**
	 * @return the groupsDao
	 */
	public IGroupsDao getGroupsDao() {
		return groupsDao;
	}

	/**
	 * @param groupsDao the groupsDao to set
	 */
	public void setGroupsDao(IGroupsDao groupsDao) {
		this.groupsDao = groupsDao;
	}

}
